#define _CRT_SECURE_NO_WARNINGS 1



#include<iostream>
using namespace std;
const int N = 130;
int f[N][N];
int main()
{
    int n;
    cin >> n;
    for (int i = 1;i <= n;i++)
    {
        for (int j = 1;j <= n;j++)
        {
            int x;
            cin >> x;
            f[i][j] = f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1] + x;
        }
    }

    int ret = -128;
    for (int x1 = 1;x1 <= n;x1++)
    {
        for (int y1 = 1;y1 <= n;y1++)
        {
            for (int x2 = 1;x2 <= n;x2++)
            {
                for (int y2 = 1;y2 <= n;y2++)
                {
                    if (x1 >= x2 || y1 >= y2)
                        continue;
                    int sum = f[x2][y2] - f[x1 - 1][y2] - f[x2][y1 - 1] + f[x1 - 1][y1 - 1];
                    ret = max(ret, sum);
                }
            }
        }
    }
    cout << ret;
    return 0;
}